<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <button @click="handler">修改对象数据</button>
        <ul>
            <li v-for="value in object" :key="item">{{key}}---{{value}}</li>
        </ul>
    </div>
    <script>
        Vue.config.productionTip = false;
        
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    object:{
                        name:"laowu",
                        age:"23",
                        score:{
                            math:176,
                            ch:80,
                        }
                    }
                    
                }
            },
            methods: {
                handler(){
                    //1. 可以直接找到具体属性(没有层级限制，响应式)
                    //  this.object.name="laozeng";

                    //2.重新赋值，解构(响应式)
                    // this.object={...this.object,age:20}

                    // 3.使用vm.$set 和Vue.set方法增加(响应式)
                    // this.$set(this.object,"sex","nan")
                    // Vue.set(this.object,"sex","nv")

                    // 4.删除Vue.delete 和vm.$delete(响应式)
                    // Vue.delete(this.object,"age")
                    // vm.$delete(this.object,"age")
                    }
                 },

        })
</script>
</body>

</html>